<?php
abstract class commons{
	var 
		$items = array();
	function count(){
		return is_array($this->items) ? count($this->items) : -1;
	}
	function the_count(){
		echo $this->count();
	}
	
	function url($echo=true){
		$return = url.get_class($this).'/';
		if ($echo){
			echo $return;
		}
		return $return;
	}
	function url_edit($echo=true,$id=null){
		$return = url.get_class($this).'/edit/'.$id.'/';
		if ($echo){
			echo $return;
		}
		return $return;
	}
	function url_delete($echo=true,$id=null){
		$return = url.get_class($this).'/delete/'.$id.'/';
		if ($echo){
			echo $return;
		}
		return $return;
	}
	
	
	function event($event_name,$description=''){
		add_event($event_name,$description,get_class($this));
	}

	function dbError($comment=''){
		$this->event('db_error',$comment);
	}

}
?>